/* 
 * 访问山阁数据服务中心
 */

var kz = {};
kz.sg = {};
kz.sg.models = {
};

kz.sg.datasvc = {
    demo_test: function() {
        alert(1);
        var ss = DemoSvc.test({lw: "jineral"});
        alert(ss);
    }
};

kz.sg.datasvc.wosah = {
    
    loadFirstFuns:function(uid){
        var rst = WosahService.loadReaderInterestFuns({uid: uid, from: 0});        
        return this.stringToJsonObj(rst);        
    },
    
    savefun: function(fun) {
        var rst = WosahService.saveFun({$entity: JSON.stringify(fun)});
        alert(rst);
        return this.stringToJsonObj(rst);        
    },
    
    loadFirstArt: function(uid) {
        var arts = WosahService.loadNextReaderInterestArticles({uid: uid, from: 0});
        return eval(arts);
    },
    saveArticle: function(uid, parts) {
        var rst = WosahService.saveArticle({$entity: JSON.stringify(parts), uId: uid});
        alert(rst);
    },
    
    stringToJsonObj:function(s){
        try{
            return eval("("+s+")");
        }catch(ex){
            alert(ex);
            return null;
        }
    }
}
